using UnityEngine;
using System.Collections;

public class ItemScript : AudioSprite {
	
	private const float ITEM__NOTE_VOLUME_PERCENT = .3f;
	//this sprite
	tk2dSprite sprite;
	
	// Use this for initialization
	override protected void Start () {
		base.Start();
		noteVolume = ITEM__NOTE_VOLUME_PERCENT;
		sprite = gameObject.GetComponent<tk2dSprite>();
		playRandom();
	}
	
	// Update is called once per frame
	override protected void Update () {
		updateDepthPosition();
		updateColor();
		base.Update();
	}
	
	//updates the color from black to white depending on the percent of the pitch in the range
	void updateColor() {
		float pitchSpaceSize = Synth.MAX_NOTE - Synth.MIN_NOTE;
		float noteMagnitude = note - Synth.MIN_NOTE;
		float pitchPercent = noteMagnitude/pitchSpaceSize;
		sprite.color = new Color(0, pitchPercent*.5f, 0);
	}
	
	/*code for recognizing it's been collided with -- was going to highlight via color change
	void OnControllerColliderHit (ControllerColliderHit hit)
	{
		if (hit.gameObject.CompareTag ("player") ){
			sprite.color.r += 
		}	
		
	}*/
}
